class A:

    @staticmethod
    def print_info(xx):
        """ 这里没有用到任何实例属性或方法，所以改成静态方法"""
        print(xx)


class Date:

    def __init__(self, year, month, day):
        self.year = year
        self.month = month
        self.day = day

    def __str__(self):
        return f"{self.year}-{self.month}-{self.day}"

    @staticmethod
    def date_from_str(date_str: str):
        """创建对象的辅助方法"""
        year, month, day = date_str.split('-')
        return Date(year, month, day)

    @classmethod
    def date_from_str(cls,date_str: str):
        """创建对象的辅助方法"""
        year, month, day = date_str.split('-')
        return cls(year, month, day)


if __name__ == '__main__':
    date = Date(2023, 5, 15)
    print(date)
    date = Date.date_from_str('2023-5-15')
    print(date)
